/***********************************************************
 * Product Name: ExcelQuicker
 * Copyright (c)2005, Eunge
 * Author: Eunge
 * Web Site: www.eudev.net
 * Mail/MSN: eudev.net@yeah.net
 * ********************************************************/
using System;

namespace ExcelQuicker.Framework
{
	/// <summary>
	/// Subtotals type of pivot field
	/// </summary>
	[Serializable]
	public class EQPivotSubtotalsType: EQObject  
	{
		private EQBool mAuto = EQBool.Default;
		private EQBool mSum = EQBool.Default;
		private EQBool mCount = EQBool.Default;
		private EQBool mAverage = EQBool.Default;
		private EQBool mMax = EQBool.Default;
		private EQBool mMin = EQBool.Default;
		private EQBool mProduct = EQBool.Default;
		private EQBool mCountNums = EQBool.Default;
		private EQBool mStdDev = EQBool.Default;
		private EQBool mStdDevp = EQBool.Default;
		private EQBool mVar = EQBool.Default;
		private EQBool mVarp = EQBool.Default;

		
		/// <summary>
		/// Automatic
		/// </summary>
		public bool Auto
		{
			get
			{
				return EQKit.ToBool(this.mAuto);
			}
			set
			{
				this.mAuto = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Average
		/// </summary>
		public bool Average
		{
			get
			{
				return EQKit.ToBool(this.mAverage);
			}
			set
			{
				this.mAverage = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Count
		/// </summary>
		public bool Count
		{
			get
			{
				return EQKit.ToBool(this.mCount);
			}
			set
			{
				this.mCount = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Count Numbers
		/// </summary>
		public bool CountNums
		{
			get
			{
				return EQKit.ToBool(this.mCountNums);
			}
			set
			{
				this.mCountNums = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Max
		/// </summary>
		public bool Max
		{
			get
			{
				return EQKit.ToBool(this.mMax);
			}
			set
			{
				this.mMax = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Min
		/// </summary>
		public bool Min
		{
			get
			{
				return EQKit.ToBool(this.mMin);
			}
			set
			{
				this.mMin = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Product
		/// </summary>
		public bool Product
		{
			get
			{
				return EQKit.ToBool(this.mProduct);
			}
			set
			{
				this.mProduct = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// StdDev
		/// </summary>
		public bool StdDev
		{
			get
			{
				return EQKit.ToBool(this.mStdDev);
			}
			set
			{
				this.mStdDev = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// StdDevp
		/// </summary>
		public bool StdDevp
		{
			get
			{
				return EQKit.ToBool(this.mStdDevp);
			}
			set
			{
				this.mStdDevp = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Sum
		/// </summary>
		public bool Sum
		{
			get
			{
				return EQKit.ToBool(this.mSum);
			}
			set
			{
				this.mSum = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Var
		/// </summary>
		public bool Var
		{
			get
			{
				return EQKit.ToBool(this.mVar);
			}
			set
			{
				this.mVar = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Varp
		/// </summary>
		public bool Varp
		{
			get
			{
				return EQKit.ToBool(this.mVarp);
			}
			set
			{
				this.mVarp = EQKit.ToEQBool(value);
			}
		}

		/// <summary>
		/// Set/Get subtotals by setting index
		/// </summary>
		public bool this[int index]
		{
			get
			{
				switch(index)
				{
					case 1:
						return this.Auto;
					case 2:
						return this.Sum;
					case 3:
						return this.Count;
					case 4:
						return this.Average;
					case 5:
						return this.Max;
					case 6:
						return this.Min;
					case 7:
						return this.Product;
					case 8:
						return this.CountNums;
					case 9:
						return this.StdDev;
					case 10:
						return this.StdDevp;
					case 11:
						return this.Var;
					case 12:
						return this.Varp;
					default:
						throw new EQException("EQ1004", this.GetType().ToString(), index.ToString());
				}
			}
			set
			{
				switch(index)
				{
					case 1:
						this.Auto = value;
						break;
					case 2:
						this.Sum = value;
						break;
					case 3:
						this.Count = value;
						break;
					case 4:
						this.Average = value;
						break;
					case 5:
						this.Max = value;
						break;
					case 6:
						this.Min = value;
						break;
					case 7:
						this.Product = value;
						break;
					case 8:
						this.CountNums = value;
						break;
					case 9:
						this.StdDev = value;
						break;
					case 10:
						this.StdDevp = value;
						break;
					case 11:
						this.Var = value;
						break;
					case 12:
						this.Varp = value;
						break;
					default:
						throw new EQException("EQ1004", this.GetType().ToString(), index.ToString(EQKit.ObjNumberFormatInfo));
				}
			}
		}

	}
}
